﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ServiceConsumer;
using System.Web.Services;

public partial class TestWSBroker : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        string strURL = "http://miracle.somee.com/MiracleService.asmx";
        string strUserName = "maiquangdao@gmail.com";
        string strPass = "123456abc";

        List<object> paras = new List<object>();
        paras.Add(strUserName);
        paras.Add(strPass);

        //object oSID = WSProxy.CallWebService(strURL, "WSLogin", paras.ToArray());
        object oSID = WSProxy.CallWebService(strURL, "MiracleService", "WSLogin", paras.ToArray());
        string sSID = oSID.ToString();
        Label1.Text = sSID;
        if (sSID.Equals("0"))
        {
            Label1.Text = "Thông tin đăng nhập không đúng";
            return;
        }

        //paras = new List<object>();
        //string sCreditCard = "5125479313709144";
        //float fMoney = 50;
        //string sSecureCode = "72855";
        //string sCardHolder = "quangdao";
        //paras.Add(sSID);
        //paras.Add(sCreditCard);
        //paras.Add(fMoney);
        //paras.Add(sSecureCode);
        //paras.Add(sCardHolder);
        ////
        object[] paras1 = new object[5];
        paras1[0] = oSID;
        paras1[1] = "5125479313709144";
        paras1[2] = 100;
        paras1[3] = "72855";
        paras1[4] = "quangdao";

        object oResult = WSProxy.CallWebService(strURL, "MiracleService", "TraferMoneyForCustomer", paras1);
        Label2.Text = oResult.ToString();
    }

    protected void Button2_Click(object sender, EventArgs e)
    {
        string strURL = "http://nganluong.ducquyen.net/WS/WSMoiGioi.asmx";
        string strUserName = "em07-nkd";
        string strPass = "em07-nkd";

        List<object> paras = new List<object>();
        paras.Add(strUserName);
        paras.Add(strPass);

        object oSID = WSProxy.CallWebService(strURL, "WSLogin", paras.ToArray());
        string sSID = oSID.ToString();
        Label1.Text = sSID;
        if (sSID.Equals("0"))
        {
            Label1.Text = "Thông tin đăng nhập không đúng";
            return;
        }

        paras = new List<object>();
        string sCreditCard = "5115378202608031";
        float fMoney = 50;
        //string sSecureCode = "72855";
        //string sCardHolder = "quangdao";
        paras.Add(sSID);
        paras.Add(sCreditCard);
        paras.Add(fMoney);
        //paras.Add(sSecureCode);
        //paras.Add(sCardHolder);
        object oResult = WSProxy.CallWebService(strURL, "TranferMoneyForCustomer", paras.ToArray());
        Label2.Text = oResult.ToString();
    }
}